package sis.studentinfotest;/*
 * @auther 顶风少年
 * @mail dfsn19970313@foxmail.com
 * @date 2019-07-20 08:34
 * @notify
 * @version 1.0
 */

import sis.studentinfo.Course;
import sis.studentinfo.CourseSession;
import sis.studentinfo.DateUtil;
import sis.studentinfo.Session;
import sun.dc.pr.PRError;

import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class CourseSessionTest extends SessionTest {

    public void testCourseDates() {
        Date startDate = DateUtil.createDate(2003,1,6);
        Session session = createSession(new Course("ENGL","200"),startDate);
        Date sixteenWeeksout = DateUtil.createDate(2003, 4, 25);
        assertEquals(sixteenWeeksout, session.getEndDate());
    }

    public void testCount() {
        CourseSession.resetCount();
        createSession(createCourse(),new Date());
        assertEquals(1, CourseSession.getCount());
        createSession(createCourse(),new Date());
        assertEquals(2, CourseSession.getCount());
    }
    private Course createCourse(){
        return new Course("ENGL","101");
    }
    protected Session createSession(Course course, Date date) {
        return CourseSession.create(course,date);
    }

}
